const multipartUrl="http://175.24.203.136:8081/tj-chat/fileServer/getFileFromParam?filePath=tiannuo/images/";
export const tempOrderList = [
	{
		id:'001',
		orderCode:'1111111111111111',
		deliveryWay:0,
		payStatus:0,
		payCountDown:10,
		createTime:'2022年8月19日13:26:15',
		payAmount:'188.00',
		mobile:'18174403051',
		pickUpTime:{value: '1',label: '很快取餐'},
		pickUpWay:0,
		payWay:0,
		goodList:[
			{
				skuId:'good001',
				goodName:'好太太面包',
				count:1,
				price:'100.00',
				url:multipartUrl+'goods/1.jpg',
				skuRules:[
					{
						ruleId:0,
						attrTitle:'温度',
						attrValues:[
							{'tagId':'0','tagLable':'标准','selected':true},
							{'tagId':'1','tagLable':'少冰','selected':false},
						],
					},
					{
						ruleId:1,
						attrTitle:'糖度',
						attrValues:[
							{'tagId':'0','tagLable':'标准','selected':true},
							{'tagId':'1','tagLable':'少冰','selected':false},
						],
					},
					{
						ruleId:2,
						attrTitle:'尺寸',
						attrValues:[
							{'tagId':'0','selected':true,'tagLable':'大(10寸)'},
							{'tagId':'1','selected':false,'tagLable':'中(8寸)'},
							{'tagId':'2','selected':false,'tagLable':'小(6寸)'},
						],
					},
					{	
						ruleId:3,
						attrTitle:'包装',
						attrValues:[
							{'tagId':'0','tagLable':'精致','selected':true,},
							{'tagId':'1','tagLable':'普通','selected':false,},
						],
					},
				],
			},
			{
				skuId:'good002',
				goodName:'儿童生日蛋糕',
				count:1,
				price:'88.00',
				url:multipartUrl+'goods/2.jpg',
				skuRules:[
					{
						ruleId:0,
						attrTitle:'温度',
						attrValues:[
							{'tagId':'0','tagLable':'标准','selected':true},
							{'tagId':'1','tagLable':'少冰','selected':false},
						],
					},
					{
						ruleId:1,
						attrTitle:'糖度',
						attrValues:[
							{'tagId':'0','tagLable':'标准','selected':true},
							{'tagId':'1','tagLable':'少冰','selected':false},
						],
					},
					{	
						ruleId:2,
						attrTitle:'包装',
						attrValues:[
							{'tagId':'0','tagLable':'精致','selected':true,},
							{'tagId':'1','tagLable':'普通','selected':false,},
						],
					},
				],
			}
		]
	},
	{
		id:'002',
		orderCode:'2222222222222222',
		deliveryWay:1,
		payStatus:1,
		payCountDown:0,
		createTime:'2022年8月19日13:26:15',
		payAmount:'100.00',
		mobile:'18174403052',	
		pickUpWay:0,
		pickUpTime:{value: '1',label: '很快取餐'},
		payWay:1,	
		goodList:[
			{
				skuId:'good003',
				goodName:'好吃你就多吃点',
				count:1,
				price:'100.00',
				url:multipartUrl+'goods/1.jpg',
				skuRules:[
					{
						ruleId:0,
						attrTitle:'温度',
						attrValues:[
							{'tagId':'0','tagLable':'标准','selected':true},
							{'tagId':'1','tagLable':'少冰','selected':false},
						],
					},
					{
						ruleId:1,
						attrTitle:'糖度',
						attrValues:[
							{'tagId':'0','tagLable':'标准','selected':true},
							{'tagId':'1','tagLable':'少冰','selected':false},
						],
					},
					{
						ruleId:2,
						attrTitle:'尺寸',
						attrValues:[
							{'tagId':'0','selected':true,'tagLable':'大(10寸)'},
							{'tagId':'1','selected':false,'tagLable':'中(8寸)'},
							{'tagId':'2','selected':false,'tagLable':'小(6寸)'},
						],
					},
					{	
						ruleId:3,
						attrTitle:'包装',
						attrValues:[
							{'tagId':'0','tagLable':'精致','selected':true,},
							{'tagId':'1','tagLable':'普通','selected':false,},
						],
					},
				],
			},
		]
	}
				
]
export const tempHistoryOrderList = [
	{
		id:'003',
		orderCode:'3333333333333333',
		deliveryWay:1,
		payCountDown:0,
		payStatus:3,
		createTime:'2022年8月19日13:27:43',
		payAmount:'300.00',
		mobile:'18174403053',
		pickUpWay:0,
		pickUpTime:{value: '1',label: '很快取餐'},
		payWay:0,			
		goodList:[
			{
				skuId:'good003ss',
				goodName:'私人订制蛋糕',
				count:1,
				price:'100.00',
				url:multipartUrl+'goods/3.jpg',
				skuRules:[
					{
						ruleId:0,
						attrTitle:'温度',
						attrValues:[
							{'tagId':'0','tagLable':'标准','selected':true},
							{'tagId':'1','tagLable':'少冰','selected':false},
						],
					},
					{
						ruleId:1,
						attrTitle:'糖度',
						attrValues:[
							{'tagId':'0','tagLable':'标准','selected':true},
							{'tagId':'1','tagLable':'少冰','selected':false},
						],
					},
					{
						ruleId:2,
						attrTitle:'尺寸',
						attrValues:[
							{'tagId':'0','selected':true,'tagLable':'大(10寸)'},
							{'tagId':'1','selected':false,'tagLable':'中(8寸)'},
							{'tagId':'2','selected':false,'tagLable':'小(6寸)'},
						],
					},
					{	
						ruleId:3,
						attrTitle:'包装',
						attrValues:[
							{'tagId':'0','tagLable':'精致','selected':true,},
							{'tagId':'1','tagLable':'普通','selected':false,},
						],
					},
				],
			},
			{
				skuId:'good004ddd',
				goodName:'好吃你就多吃点面包',
				count:2,
				price:'100.00',
				url:multipartUrl+'goods/4.jpg',
				skuRules:[
					{
						ruleId:0,
						attrTitle:'温度',
						attrValues:[
							{'tagId':'0','tagLable':'标准','selected':true},
							{'tagId':'1','tagLable':'少冰','selected':false},
						],
					},
					{
						ruleId:1,
						attrTitle:'糖度',
						attrValues:[
							{'tagId':'0','tagLable':'标准','selected':true},
							{'tagId':'1','tagLable':'少冰','selected':false},
						],
					},
					{
						ruleId:2,
						attrTitle:'尺寸',
						attrValues:[
							{'tagId':'0','selected':true,'tagLable':'大(10寸)'},
							{'tagId':'1','selected':false,'tagLable':'中(8寸)'},
							{'tagId':'2','selected':false,'tagLable':'小(6寸)'},
						],
					},
					{	
						ruleId:3,
						attrTitle:'包装',
						attrValues:[
							{'tagId':'0','tagLable':'精致','selected':true,},
							{'tagId':'1','tagLable':'普通','selected':false,},
						],
					},
				],
			}
		]
	},
	{
		id:'004',
		orderCode:'444444444444',
		deliveryWay:0,
		payCountDown:0,
		payStatus:2,
		createTime:'2022年8月19日13:26:15',
		payAmount:'100.00',
		mobile:'18174403054',
		pickUpWay:1,
		pickUpTime:{value: '1',label: '很快取餐'},
		payWay:1,	
		goodList:[
			{
				skuId:'good005saxc',
				goodName:'好吃你就多吃点',
				count:1,
				price:'100.00',
				url:multipartUrl+'goods/1.jpg',
				skuRules:[
					{
						ruleId:0,
						attrTitle:'温度',
						attrValues:[
							{'tagId':'0','tagLable':'标准','selected':true},
							{'tagId':'1','tagLable':'少冰','selected':false},
						],
					},
					{
						ruleId:1,
						attrTitle:'糖度',
						attrValues:[
							{'tagId':'0','tagLable':'标准','selected':true},
							{'tagId':'1','tagLable':'少冰','selected':false},
						],
					},
					{
						ruleId:2,
						attrTitle:'尺寸',
						attrValues:[
							{'tagId':'0','selected':true,'tagLable':'大(10寸)'},
							{'tagId':'1','selected':false,'tagLable':'中(8寸)'},
							{'tagId':'2','selected':false,'tagLable':'小(6寸)'},
						],
					},
					{	
						ruleId:3,
						attrTitle:'包装',
						attrValues:[
							{'tagId':'0','tagLable':'精致','selected':true,},
							{'tagId':'1','tagLable':'普通','selected':false,},
						],
					},
				],
			},
		]
	}
]
//添加历史订单
export const addHistoryOrder=function(order){
	tempHistoryOrderList.unshift(order);
}
//删除支付超时的订单
export const subPayTimeoutOrder=function(order){
	let delIndex= tempOrderList.findIndex(function(item){
		return item.id==order.id;
	});
	console.log("删除元素的下标",delIndex);
	tempOrderList.splice(delIndex,1);
}
//新增订单
export const addNewOrder=function(order){
	tempOrderList.unshift(order);
}
//修改订单状态 newPayStatus:0待支付 1 待发货 2已完成 3已取消
export const changeOrderStatus=function(order,newPayStatus){
	tempOrderList.forEach(function(item){
		if(item.id==order.id){
			item.payCountDown=0;
			item.payStatus=newPayStatus;
		}
	})
}
//获取订单详情
export const getOrderDetailInfo=function(orderId){
	//实际请求后端只需要通过id去查询就行，这里模拟查询需要将历史订单和当前订单合并，然后再检索出来
	let orderList=tempOrderList.concat(tempHistoryOrderList);
	let orderInfo= orderList.find(function(orderItem){
		return orderItem.id==orderId;
	})
	return orderInfo;
}